package fs.tileMap.view.tile {
	import flash.display.MovieClip;
	import flash.display.Sprite;
	
	/**
	 * The default implemention of interface ITile
	 * Implemented by gotoAndStop(i)
	 * @author flyingSnow
	 */
	public class DefaultTile extends AbstractTile{
		private var _vecTiles:Vector.<Sprite>;
		
		public function DefaultTile() {
			createTiles();
		}
		
		private function createTiles():void {
			_vecTiles = new Vector.<Sprite>();
			for (var i:int = 0; i < 8; i++ ) {
				var s:Sprite = new Sprite();
				s.graphics.lineStyle(1);
				s.graphics.beginFill(i * 0xf);
				s.graphics.drawRect(0, 0, getTileWidth(),getTileHeight());
				s.graphics.endFill();
				addChild(s);
				_vecTiles.push(s);
			}
		}
		
		override protected function render(code:int):void {
			//gotoAndStop(code);
			for (var i:int = 0; i < 8; i++ ) {
				var s:Sprite = _vecTiles[s];
				s.visible = (code==i);
			}
		}		
	}

}